package com.core.controller.test;

import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RoleTestController {
    @RequestMapping(value = "/adminOrUser",method = RequestMethod.GET)
    @RequiresRoles(value = {"超级管理员","普通用户"},logical = Logical.OR)
    public String adminOrUser() {
        return "管理员或用户";
    }

    @RequestMapping(value = "/admin",method = RequestMethod.GET)
    @RequiresRoles(value = {"超级管理员"})
    public String admin() {
        return "管理员";
    }

    @RequestMapping(value = "/user",method = RequestMethod.GET)
    @RequiresRoles(value = {"普通用户"})
    public String user() {
        return "普通用户";
    }

    @RequestMapping(value = "/test",method = RequestMethod.GET)
    @RequiresRoles(value = {"测试角色"})
    public String test() {
        return "测试角色";
    }
}
